# -*- coding: utf-8 -*-
# @Time    : 2021/3/12 11:47
# @Author  : wenyao
# @Email   : 343292019@qq.com
# @File    : git的使用.py


#1、本地安装好git软件
#2、创建好代码目录
#3、进入创建好的代码目录，右键选择 Git bash here 进入git bash环境
#   注意：git bash环境的操作命令和linux操作系统类似
#        可以使用mkdir，cp，ls，rm 等命令
#4、在当前目录下创建目录sdyxzcode
#5、进入sdyxzcode执行命令： git init
#    注意：这一步是将普通目录sdyxzcode变成git仓库
#         敲完命令后，此文件夹下会多出一个.git的文件夹（这里面存放此git仓库的元数据，勿删！！！！）


# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode
# $ git init
# Initialized empty Git repository in E:/sdyxz/sdyxzcode/.git/
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ ls
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ touch aa bb
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ ls
# aa  bb
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git add aa bb  #将aa bb文件放入暂存区
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git config --global user.name "wenyao"  #设置仓库提交用户名
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git config --global user.email "343292019@qq.com"  #设置仓库提交的email
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git commit -m "first commit"
# [master (root-commit) bd45ec9] first commit
# 2 files changed, 0 insertions(+), 0 deletions(-)
# create mode 100644 aa
# create mode 100644 bb
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git log
# commit bd45ec911eebe6aa82f6e40230effc535181c502 (HEAD -> master)
# Author: 汤旋 <972451910@qq.com>
# Date:   Fri Mar 12 11:54:00 2021 +0800
#
# first commit
#
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git log -p
# commit bd45ec911eebe6aa82f6e40230effc535181c502 (HEAD -> master)
# Author: 汤旋 <972451910@qq.com>
# Date:   Fri Mar 12 11:54:00 2021 +0800
#
# first commit
#
# diff --git a/aa b/aa
# new file mode 100644
# index 0000000..e69de29
# diff --git a/bb b/bb
# new file mode 100644
# index 0000000..e69de29

#回滚版本
# --hard 表示历史版本回滚，文件内容也回滚
# --soft 表示历史版本回滚，文件内容不会回滚
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git reset 07fda4446a3ea8899036fdbe717c9e4c7c33bb75 --hard
# HEAD is now at 07fda44 test2
# Administrator@Sanchuang1234 MINGW64 /e/sdyxz/sdyxzcode (master)
# $ git reset 07fda4446a3ea8899036fdbe717c9e4c7c33bb75 --soft

#看文件修改，以及暂存区有哪些文件：
# $ git status
# On branch master
# Changes to be committed:
# (use "git restore --staged <file>..." to unstage)
# modified:   aa

#拉取远程仓库的代码
#git pull origin master

#推送代码到远程仓库
#git push origin master

#查看远程仓库映射
#git  remote -v

#克隆远程仓库
#git clone xxxxxx

#添加远程仓库别名映射
#git remote add origin xxxxxxx



